<div class="breadcrumb">
    <ul id="breadcrumb">
        <li><a href="<?php echo Configure::read('base_url');?>backstage" title="Home">
		<?php echo $this->Html->image("home.png", array("alt" => "Home",'class'=>'home','border'=>'0'));?>
		</a></li>
        <li><a href="<?php echo Configure::read('base_url');?>backstage/users" title="Manage Admin">Manage Q-Admin</a></li>
        <li><a href="<?php echo Configure::read('base_url');?>backstage/users/qadmin_summary/<?php echo $users['User']['id'];?>" title="Q-Admin Summary Page">Q-Admin Summary Page</a></li>
        <li>Q-Admin Selling History</li>
    </ul>
</div>
<?php echo $this->element('admin/admin_leftmenu'); ?>
<div id="left"> 
    <?php
		echo $this->Session->flash();
		if ($this->Session->check('Message.auth'))
        echo $this->Session->flash('auth');
    ?>
    <br class="clear" />
    <div class="div_header"><?php __('Selling history of '.$users['User']['username']." between ".date("m/d/Y",strtotime($users['QadminSummary']['period1'])).' - '.date("m/d/Y",strtotime($users['QadminSummary']['period2'])));?></div>
    <div class="div_content">
		<b>Sold Quantity: <?php echo $users['QadminSummary']['product_sold'];?></b><br />
		Details:<br />
		<table id="category_table" cellspacing="0" class="tablesorter">
			<thead>
				<tr>
					<th align="center"></th>
					<th align="center">Item #</th>
					<th align="center">Title</th>
					<th align="center">Times Sold</th>
					<th align="center">Commission Rate</th>
					<th align="center">Commission Earned</th>
				</tr>
			</thead>
			<tbody>
        <?php if($solds){
				$i=0;
				foreach($solds as $sold){
				$class ="";
                if ($i++ % 2 == 0)
				    $class = ' class="alt"';
				?>   
				<tr>
					<td align="center" <?php echo $class;?>><img src="<?php echo Configure::read('base_url');?>img/uploads/<?php echo $sold['Product']['products_thumbnailImage'];?>" width="80" border="0" /></td>
					<td align="center" <?php echo $class;?>><?php echo $sold['Product']['id'];?></td>
                    <td align="center" <?php echo $class;?>><?php echo $sold['Product']['products_title'];?></td>
                    <td align="center" <?php echo $class;?>><?php echo $total_sold = $this->requestAction('/users/total_sold/'.$sold['Product']['id'].'/'.strtotime($users['QadminSummary']['period1']).'/'.strtotime($users['QadminSummary']['period2']));?></td>
                    <td align="center" <?php echo $class;?>>$0.30</td>
                    <td align="center" <?php echo $class;?>>$<?php echo($total_sold*0.30)?></td>
                </tr>
		<?php $i++;}}else{?>
		<tr><td colspan="6">No data found</td></tr>
		<?php } ?>        
			</tbody>
		</table>
		
    </div>
    <div class="div_bottom"></div>
</div>
<?php  echo $html->script(array("jquery.pagination.js","jquery.tablesorter.min.js","jquery.tablednd.js")); ?>	 
 <script type="text/javascript">  
 jQuery(document).ready(function(){
 jQuery("#category_table").tablesorter(); 
 });	
 </script>